package com.jl.jlapp.mvp.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public abstract class LazyLoadFragment
  extends Fragment
{
  private boolean isLoadDataCompleted;
  private boolean isViewCreated;
  
  public abstract int initLayout();
  
  public abstract void initViews(View paramView);
  
  public abstract void loadData();
  
  public void onActivityCreated(@Nullable Bundle paramBundle)
  {
    super.onActivityCreated(paramBundle);
    if (getUserVisibleHint())
    {
      this.isLoadDataCompleted = true;
      loadData();
    }
  }
  
  @Nullable
  public View onCreateView(LayoutInflater paramLayoutInflater, @Nullable ViewGroup paramViewGroup, @Nullable Bundle paramBundle)
  {
    View view = paramLayoutInflater.inflate(initLayout(), paramViewGroup, false);
    initViews(view);
    this.isViewCreated = true;
    return view;
  }
  
  public void setUserVisibleHint(boolean paramBoolean)
  {
    super.setUserVisibleHint(paramBoolean);
    if ((paramBoolean) && (this.isViewCreated) && (!this.isLoadDataCompleted))
    {
      this.isLoadDataCompleted = true;
      loadData();
    }
  }
}


/* Location:              /Users/davidzhang/Documents/decompileApk/jlfood-dex2jar.jar!/com/jl/jlapp/mvp/fragment/LazyLoadFragment.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */